******************************************************************************
*** PAPER: THE ITALIAN POLITICAL CLASS
*** FILE NAME: "9 - breakoff analysis in interview"
*** AUTHOR: Isernia, Martini, Olmastroni, Verzichelli
*** DATASET: "surveydata_01.dta"
*** SECTIONS: ***1. BREAKOFF ANALYSIS
*******************************************************************************/

*** 1. BREAKOFF ANALYSIS

	clear all
	*SET DIRECTORY

	use "surveydata_01.dta"
	
*Factors decisions
	gen decfactor1st=1 if ELITE_LOP1_1==1
	replace decfactor1st=2 if ELITE_LOP1_2==1
	replace decfactor1st=3 if ELITE_LOP1_3==1
	replace decfactor1st=4 if ELITE_LOP1_4==1
	replace decfactor1st=5 if ELITE_LOP1_5==1
	replace decfactor1st=6 if ELITE_LOP1_6==1
	replace decfactor1st=7 if ELITE_LOP1_7==1
	replace decfactor1st=8 if ELITE_LOP1_8==1
	replace decfactor1st=9 if ELITE_LOP1_9==1
	replace decfactor1st=10 if ELITE_LOP1_10==1
	replace decfactor1st=11 if ELITE_LOP1_98==1
	replace decfactor1st=12 if ELITE_LOP1_99==1
	
	lab define decfactor1st 1"Party manifesto" 2"Int Gr" 3"Experts" 4"Pub Op" 5"Constituency" 6"Pub Adm" 7"Media" 8"Oppos" 9"Party factions" 10"Party allied" 11"DK" 12"NA", replace
	lab val decfactor1st decfactor1st
	
	gen decfactor2nd=1 if ELITE_LOP1_1==2
	replace decfactor2nd=2 if ELITE_LOP1_2==2
	replace decfactor2nd=3 if ELITE_LOP1_3==2
	replace decfactor2nd=4 if ELITE_LOP1_4==2
	replace decfactor2nd=5 if ELITE_LOP1_5==2
	replace decfactor2nd=6 if ELITE_LOP1_6==2
	replace decfactor2nd=7 if ELITE_LOP1_7==2
	replace decfactor2nd=8 if ELITE_LOP1_8==2
	replace decfactor2nd=9 if ELITE_LOP1_9==2
	replace decfactor2nd=10 if ELITE_LOP1_10==2
	replace decfactor2nd=11 if ELITE_LOP1_98==2
	replace decfactor2nd=12 if ELITE_LOP1_99==2
	
	lab define decfactor2nd 1"Party manifesto" 2"Int Gr" 3"Experts" 4"Pub Op" 5"Constituency" 6"Pub Adm" 7"Media" 8"Oppos" 9"Party factions" 10"Party allied" 11"DK" 12"NA", replace
	lab val decfactor2nd decfactor2nd

	gen decfactor3rd=1 if ELITE_LOP1_1==3
	replace decfactor3rd=2 if ELITE_LOP1_2==3
	replace decfactor3rd=3 if ELITE_LOP1_3==3
	replace decfactor3rd=4 if ELITE_LOP1_4==3
	replace decfactor3rd=5 if ELITE_LOP1_5==3
	replace decfactor3rd=6 if ELITE_LOP1_6==3
	replace decfactor2nd=7 if ELITE_LOP1_7==3
	replace decfactor3rd=8 if ELITE_LOP1_8==3
	replace decfactor3rd=9 if ELITE_LOP1_9==3
	replace decfactor3rd=10 if ELITE_LOP1_10==3
	replace decfactor3rd=11 if ELITE_LOP1_98==3
	replace decfactor3rd=12 if ELITE_LOP1_99==3
	
	lab define decfactor3rd 1"Party manifesto" 2"Int Gr" 3"Experts" 4"Pub Op" 5"Constituency" 6"Pub Adm" 7"Media" 8"Oppos" 9"Party factions" 10"Party allied" 11"DK" 12"NA", replace
	lab val decfactor3rd decfactor3rd

	order decfactor1st decfactor2nd decfactor3rd, before(ELITE_LOP2_A)

*changes to democracy
	gen changedem1st=1 if ELITE_10_1==1
	replace changedem1st=2 if ELITE_10_2==1
	replace changedem1st=3 if ELITE_10_3==1
	replace changedem1st=4 if ELITE_10_4==1
	replace changedem1st=5 if ELITE_10_5==1
	replace changedem1st=6 if ELITE_10_6==1
	replace changedem1st=7 if ELITE_10_98==1
	replace changedem1st=8 if ELITE_10_99==1
	
	lab define changedem1st 1"Corrupted politicians" 2"Negative media" 3"Party decline" 4"Negative politics" 5"Judges" 6"Politicians not capable" 7"DK" 8"NA", replace
	lab val changedem1st changedem1st

	order changedem1st, before(ELITE_10_1)

*Exp 1
	egen planAB = rowtotal(ELITE_LOP4_SPLITA ELITE_LOP4_SPLITB ELITE_LOP4_SPLITC ELITE_LOP4_SPLITD)
	recode planAB (0=.) (1=1) (2=0)

	order planAB, before(ELITE_LOP6_SPLITA)

*Exp 2
	egen solutionAB = rowtotal(ELITE_LOP6_SPLITA ELITE_LOP6_SPLITB ELITE_LOP6_SPLITC)
	recode solutionAB (0=.) (1=1) (2=0)
	
 order solutionAB, before(RV4A)


*Exp 3
	gen outexp=E4B_SP1A2A if E4B_SP1A2A!=.
	replace outexp=E4B_SP1A2B if E4B_SP1A2B!=.
	replace outexp=E4B_SP1A2C if E4B_SP1A2C!=.
	replace outexp=E4B_SP1A2D if E4B_SP1A2D!=.
	replace outexp=E4B_SP1B2A if E4B_SP1B2A!=.
	replace outexp=E4B_SP1B2B if E4B_SP1B2B!=.
	replace outexp=E4B_SP1B2C if E4B_SP1B2C!=.
	replace outexp=E4B_SP1B2D if E4B_SP1B2D!=.

	order outexp, before(E4B_SP1A2A)

	gen probe=E4B_PRA   
	replace probe=E4B_PRB if E4B_PRA==. & E4B_PRC==. & E4B_PRD==.
	replace probe=E4B_PRC if E4B_PRA==. & E4B_PRB==. & E4B_PRD==.
	replace probe=E4B_PRD if E4B_PRA==. & E4B_PRB==. & E4B_PRC==.

	order probe, before(E4B_PRA)

*Exp 4
	gen outcome=ELITE_5SPLITA
	replace outcome=ELITE_5SPLITB if ELITE_5SPLITA==.

	order outcome, before(ELITE_5SPLITA)

*Drop variables
	drop ELITE_LOP1_1 ELITE_LOP1_2 ELITE_LOP1_3 ELITE_LOP1_4 ELITE_LOP1_5 ELITE_LOP1_6 ELITE_LOP1_7 ELITE_LOP1_8 ELITE_LOP1_9 ELITE_LOP1_10 ELITE_LOP1_98 ELITE_LOP1_99
	drop RLOP4LOP6 ELITE_LOP4_SPLITA ELITE_LOP4_SPLITB ELITE_LOP4_SPLITC ELITE_LOP4_SPLITD
	drop ELITE_LOP6_SPLITA ELITE_LOP6_SPLITB ELITE_LOP6_SPLITC
	drop RA2B RA2C RA3D RV4A
	drop E4B_SPLIT1 E4B_SPLIT2 SPLIT_E4B
	drop E4B_SP1A2A E4B_SP1A2B E4B_SP1A2C E4B_SP1A2D E4B_SP1B2A E4B_SP1B2B E4B_SP1B2C E4B_SP1B2D
	drop ELITE_5SPLITA ELITE_5SPLITB
	drop ELITE_10_1 ELITE_10_2 ELITE_10_3 ELITE_10_4 ELITE_10_5 ELITE_10_6 ELITE_10_98 ELITE_10_99
	drop E4B_PRA E4B_PRB E4B_PRC E4B_PRD
	*drop S3_txt
	drop SPLIT_CJEXP-LEAD6

	drop decfactor2nd decfactor3rd
	*drop S6_1 S6_2 S6_2_txt
	*dropped because filter on religion
	drop  ELITE_14B ELITE_14C
	*dropped because not asked to non-elected assessori 
	drop ELITE_8A ELITE_8B ELITE_8C ELITE_8D ELITE_8E ELITE_8F
	*dropped because filter on job
	*drop S5 
	
*Counting missings
	gen missing = ""

	foreach var of varlist A2B-E4A9_3 {
		replace missing=missing+" "+"`var'" if `var'==.
	}
	
	split missing, p(" ")
	
	replace missing1="" if missing1=="probe" & completion==0
	
*recode	
	gen question=1 if missing1=="A2B"
	replace question=2 if missing1=="A2C"
	replace question=3 if missing1=="A3D"
	replace question=4 if missing1=="A3A_1"
	replace question=5 if missing1=="A3A_2"
	replace question=6 if missing1=="A3A_3"
	replace question=7 if missing1=="A4B"
	replace question=8 if missing1=="decfactor1st"
	replace question=9 if missing1=="ELITE_LOP2_A"
	replace question=10 if missing1=="ELITE_LOP2_B"
	replace question=11 if missing1=="ELITE_LOP2_C"
	replace question=12 if missing1=="ELITE_LOP3"
	replace question=13 if missing1=="planAB"
	replace question=14 if missing1=="solutionAB"
	replace question=15 if missing1=="V4A"
	replace question=16 if missing1=="V4B1"
	replace question=17 if missing1=="V4B2"
	replace question=18 if missing1=="V4B3"
	replace question=19 if missing1=="V4B4"
	replace question=20 if missing1=="V4B5"
	replace question=21 if missing1=="ELITE_13A"
	replace question=22 if missing1=="ELITE_13B"
	replace question=23 if missing1=="ELITE_13C"
	replace question=24 if missing1=="V10A"
	replace question=25 if missing1=="V10B"
	replace question=26 if missing1=="V10C"
	replace question=27 if missing1=="outexp"
	replace question=28 if missing1=="probe"
	replace question=29 if missing1=="V6A"
	replace question=30 if missing1=="P10_A"
	replace question=31 if missing1=="P10_B"
	replace question=32 if missing1=="P10_C"
	replace question=33 if missing1=="P10_D"
	replace question=34 if missing1=="P10_E"
	replace question=35 if missing1=="P10_F"
	replace question=36 if missing1=="P13_A"
	replace question=37 if missing1=="P13_B"
	replace question=38 if missing1=="P13_C"
	replace question=39 if missing1=="P13_D"
	replace question=40 if missing1=="ELITE_1"
	replace question=41 if missing1=="P6A_1"
	replace question=42 if missing1=="P6A_2"
	replace question=43 if missing1=="ELITE_3A"
	replace question=44 if missing1=="ELITE_3B"
	replace question=45 if missing1=="ELITE_4A"
	replace question=46 if missing1=="ELITE_4B"
	replace question=47 if missing1=="ELITE_4C"
	replace question=48 if missing1=="ELITE_4D"
	replace question=49 if missing1=="outcome"
	replace question=50 if missing1=="ELITE_6"
	replace question=51 if missing1=="ELITE_7"
	replace question=52 if missing1=="changedem1st"
	replace question=53 if missing1=="ELITE_11_A"
	replace question=54 if missing1=="ELITE_11_B"
	replace question=55 if missing1=="ELITE_11_C"
	replace question=56 if missing1=="ELITE_12_A"
	replace question=57 if missing1=="ELITE_12_B"
	replace question=58 if missing1=="ELITE_12_C"
	replace question=59 if missing1=="COV10"
	replace question=60 if missing1=="COV12"
	replace question=61 if missing1=="S3"
	replace question=62 if missing1=="ELITE_14A"
	replace question=63 if missing1=="S1C1A"
	replace question=64 if missing1=="S1C1B"
	replace question=65 if missing1=="S1C1C"
	replace question=66 if missing1=="S1C1D"
	*good politician experiment not included because optional for regional, national and european politicians

*data
	keep missing1 question
	drop if question==.
	
	saveold breakoffs.dta, replace version(12)



